package zuoye1;

public class Demo9 {
    public static void main(String[] args) {
        int sum = 0;
        for (int i = 100; i < 999; i++) {
            int bai = i / 100;
            int shi = i % 100 / 10;
            int ge = i % 100 % 10;
//            System.out.println(i+","+bai+","+shi+","+ge);


            int i1 = bai*bai*bai + shi*shi*shi + ge*ge*ge;
//            System.out.print(i1+",");


            if (i==i1){
                System.out.print(i1+",");
                sum = sum + i1;
            }
        }
        System.out.println("水仙花数的和为："+sum);
    }
}
